<?php


namespace app\common\service\companyIndustry\tsinghua;

use app\common\service\BaseService;
use app\common\service\companyIndustry\industrymodel\TsinghuaDrainEmissionToFacilityParam;

/**
 * 清华方案 脱硫运行效率
 */
class SulfurEfficiencyService extends BaseService
{
    /**
     * （方案值）运行效率
     * @param $companyId
     * @param $drainId
     * @param $facilityId
     * @return bool|float
     * @throws \MongoDB\Driver\Exception\Exception
     */
    public function singleCompanySingleDrainSingleFacility($planNumber, $tsinghuaName, $facilityId)
    {
        $tsinghua = new TsinghuaDrainEmissionToFacilityParam();
        $result = $tsinghua->getPlanParamByFacilityId($facilityId, $planNumber, $tsinghuaName, 'SO2');
        if (!$result) {
            return false;
        }
        return getNum($result['efficiency'], 2);
    }

    /**
     * （方案值）脱硫运行浓度 - 返回天数
     * @param int $companyId
     * @param int $drainId
     * @param int $facilityId
     *  @param string $type days天数| hours小时数
     * @return int
     */
    public function singleCompanySingleDrainSingleFacilityDetails($planNumber, $tsinghuaName, $facilityId, $type = 'days')
    {
        $date = ['07/22','07/22','07/22','07/22'];
        $data = [1, 2, 3, 4];
        $result = [
            'date' => $date,
            'data' => $data,
        ];
        return $result;
    }


}